<?php
	####################################################
	# library import and object instance.              #
	####################################################
	# 커먼 인클루드
	include_once( '../common.php' );

	####################################################
	# request data($_POST AND $_GET FROM $_REQUEST)    #
	####################################################
	# REQUEST(get and post variables)
	//*/
	$req = $_REQUEST;
	//Nlog::puts($req['appmode_set']);
	//*/

	# GET(url variables)
	//*/
	//*/

	# POST(form variables)
	//*/
	$pmode = Request::clean_individual($_POST['mode']);
	$preturl = Request::clean_individual($_POST['returl']);
	//Nlog::put('pmode',$pmode);
	//Nlog::put('preturl',$preturl);
	//*/

	# Validation(special case validate)
	//*/
	Validation::check_is_emptys($pmode);
	Validation::check_is_emptys($preturl);
	//*/

	####################################################
	# implementation                                   #
	####################################################
	$sec->individual_access();
	//Cookier::set('dev', 1);

	switch($pmode) {
		case "set":
			if(isset($req['appmode_set']) && $req['appmode_set'] == 'dev') {
				Cookier::set('appmode', "dev");
			} else {
				Cookier::set('appmode', "product");
			}
		break;

		default : break;
	} //endswitch

?>
<?php
	# HTML START
	echo $html->custom_header(TITLE);
	echo $tplt->page_construct_javascript();
	echo $html->custom_js("{$JS}common.js");
	echo $html->custom_css("{$CSS}common.css");
	echo $html->custom_body();
?>
	<?php $tplt->app_head($NAVI)?>
	<?php $tplt->tiles_admin_sidebar($NAVI)?>
	<?php $tplt->tiles_admin_contents($pkname, $pname, $pdesc)?>


	<div class="msgbox">
		<p>
			<?php switch($pmode): case NULL : Mover::error(); break; ?>
				<?php case "set" : ?>
						<strong>어플리케이션 모드 설정</strong><br />
					<?php if(isset($req['appmode_set']) && $req['appmode_set'] == 'dev') : ?>
						쿠키가 'dev'로 설정되었습니다.
					<?php else : ?>
						쿠키가 'product'로 설정되었습니다.
					<?php endif; ?>

				<?php break; ?>
				<?php default : break; ?>
			<?php endswitch; ?>
		</p>
	</div>
	<span class="cbtn_s mart5" onclick="Mover.href('<?=$preturl?>');">확인</span>

<?php
	# HTML END
	echo $tplt->tiles_admin_footer();
	echo $tplt->page_destruct_javascript();
	include_once( '../endproc.php' );
	echo $html->html_footer();
?>